﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hrunga.PVCM.Framework;

namespace Hrunga.PVCM.Web
{
    public partial class Form<TPresenter, TView>: System.Web.UI.Page, IView
        where TPresenter: IPresenter<TView>, new() 
        where TView: IView
    {
        private readonly TPresenter presenter;

        public Form()
        {
            this.presenter = new TPresenter();
            this.presenter.Initialize(this);
            this.Load += OnPageLoaded;
        }

        public event EventHandler ViewReady;

        private void OnPageLoaded(object sender, EventArgs eventArgs)
        {
            if (this.ViewReady != null)
            {
                this.ViewReady(this, eventArgs);
            }
        }
    }
}
